#include "InitEnemyScript.h"

CInitEnemyScript::CInitEnemyScript( void ) : CScript( "Source/ScriptingSystem/Scripts/InitEnemyScript.lua" )
{
	Load();
}

CInitEnemyScript::~CInitEnemyScript( void )
{

}

void CInitEnemyScript::CallInitGroundEnemy( float& fX, float& fY, int& nWidth, int& nHeight, int& nHealth, int& nDamage, int& nID, float& fSpeed, float& fJump )
{
	// Get the intended function on the Lua state
	lua_getfield( CScriptManager::GetInstance()->GetLuaState(), LUA_GLOBALSINDEX, "InitGroundEnemy" );

	// Call Lua's intended function
	lua_call( CScriptManager::GetInstance()->GetLuaState(), 0, 9 );

	
	fX = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 1 );
	fY = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 2 );
	nWidth = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 3 );
	nHeight = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 4 );
	nHealth = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 5 );
	nDamage = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 6 );
	nID = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 7 );
	fSpeed = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 8 );
	fJump = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 9 );

	// Pop the results out
	for( int i = -1; i > -10; i-- )
		lua_pop( CScriptManager::GetInstance()->GetLuaState(), -1 );

}

void CInitEnemyScript::CallInitAirEnemy( float& fX, float& fY, int& nWidth, int& nHeight, int& nHealth, int& nDamage, int& nID, float& fSpeed )
{
	// Get the intended function on the Lua state
	lua_getfield( CScriptManager::GetInstance()->GetLuaState(), LUA_GLOBALSINDEX, "InitAirEnemy" );

	// Call Lua's intended function
	lua_call( CScriptManager::GetInstance()->GetLuaState(), 0, 8 );

	
	fX = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 1 );
	fY = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 2 );
	nWidth = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 3 );
	nHeight = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 4 );
	nHealth = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 5 );
	nDamage = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 6 );
	nID = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 7 );
	fSpeed = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 8 );

	// Pop the results out
	for( int i = -1; i > -9; i-- )
		lua_pop( CScriptManager::GetInstance()->GetLuaState(), -1 );

}

void CInitEnemyScript::CallInitMageEnemy( float& fX, float& fY, int& nWidth, int& nHeight, int& nHealth, int& nDamage, int& nID, float& fSpeed, float& fJump )
{
	// Get the intended function on the Lua state
	lua_getfield( CScriptManager::GetInstance()->GetLuaState(), LUA_GLOBALSINDEX, "InitMageEnemy" );

	// Call Lua's intended function
	lua_call( CScriptManager::GetInstance()->GetLuaState(), 0, 9 );

	
	fX = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 1 );
	fY = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 2 );
	nWidth = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 3 );
	nHeight = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 4 );
	nHealth = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 5 );
	nDamage = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 6 );
	nID = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 7 );
	fSpeed = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 8 );
	fJump = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 9 );

	// Pop the results out
	for( int i = -1; i > -10; i-- )
		lua_pop( CScriptManager::GetInstance()->GetLuaState(), -1 );

}

void CInitEnemyScript::CallInitSentinelEnemy( float& fX, float& fY, int& nWidth, int& nHeight, int& nHealth, int& nDamage, int& nID, float& fSpeed, float& fJump )
{
	// Get the intended function on the Lua state
	lua_getfield( CScriptManager::GetInstance()->GetLuaState(), LUA_GLOBALSINDEX, "InitSentinelEnemy" );

	// Call Lua's intended function
	lua_call( CScriptManager::GetInstance()->GetLuaState(), 0, 9 );

	
	fX = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 1 );
	fY = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 2 );
	nWidth = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 3 );
	nHeight = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 4 );
	nHealth = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 5 );
	nDamage = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 6 );
	nID = luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 7 );
	fSpeed = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 8 );
	fJump = (float)luaL_checkint( CScriptManager::GetInstance()->GetLuaState(), 9 );

	// Pop the results out
	for( int i = -1; i > -10; i-- )
		lua_pop( CScriptManager::GetInstance()->GetLuaState(), -1 );

}